<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/wx/page/session.jsp"%>
<c:set var="userId" value="${param.userId}" />
<c:set var="deptId" value="${param.deptId}" />
<c:set var="deptCode" value="${param.deptCode}" />
<c:set var="deptParentId" value="${param.deptParentId}" />
<c:set var="taskId" value="${param.taskId}" />
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <title>任务详情</title>
    <link rel="stylesheet" href="${ctx}/wx/css/default.css"/>
    <script type="text/javascript" src="${ctx}/dwr/engine.js"></script>
    <script type="text/javascript" src="${ctx}/dwr/util.js"></script>
    <script type="text/javascript" src="${ctx}/dwr/interface/TaskService.js"></script>
    <script type="text/javascript" src="${ctx}/wx/js/alert.js"></script>
</head>
<body style="text-align: center;">
<form id="taskForm" name="taskForm" method="post">
    <fieldset class="contact-inner">
        <p class="contact-submit">
            <input type="button" value="返回" onclick="callback()">
        </p>
        <input type="hidden" id="userId" name="userId">
        <input type="hidden" id="deptId" name="deptId" value="${deptId}">
        <input type="hidden" id="taskId" name="taskId" value="${taskId}">
        <input type="hidden" id="taskSenderUserId" name="taskSenderUserId">
        <p class="contact-input" style="text-align: left">
            <label>信息部：</label>
            <label id="deptName"></label>
        </p>
        <p class="contact-input" style="text-align: left">
            <label>联系方式：</label>
            <label id="deptLinkmanName"></label>
            <a><label id="deptLinkmanMobile"></label></a>
        </p>
        <p class="contact-input" style="text-align: left">
            <label>货物类型：</label>
            <label id="taskGoodsType"></label>
        </p>
        <p class="contact-input" style="text-align: left">
            <label>货物规格：</label>
            <label id="taskGoodsStandard"></label>
        </p>
        <p class="contact-input" style="text-align: left">
            <label>剩余车辆：</label>
            <label id="taskTruckLeftNum"></label>
            <label>(辆)</label>
        </p>
        <p class="contact-input" style="text-align: left">
            <label>装货地点：</label>
            <label id="taskLoadingArea"></label><br>
        </p>
        <p class="contact-input" style="text-align: left">
            <label>卸货地点：</label>
            <label id="taskUnloadingArea"></label><br>
            <label id="taskUnloadingAddress"></label>
        </p>
        <p class="contact-input" style="text-align: left">
            <label>备注：</label>
            <label id="taskRemark"></label>
        </p>
    </fieldset>
</form>
</body>
</html>
<script type="text/javascript">
    parent.document.title = "任务详情";
    if("${taskId}".length > 0) {
        var task = new Task();
        task.taskId = "${taskId}";
        TaskService.selectTaskList(task, callbackSelectTaskList);
    }
    function callbackSelectTaskList(list) {
        var task = list[0];
        dwr.util.setValues(task);
        dwr.util.setValue("taskTruckLeftNum", (task.taskTruckTotalNum - task.taskTruckOccupyNum));
        dwr.util.setValue("deptName", task.dept.deptName);
        dwr.util.setValue("deptLinkmanName", task.dept.deptLinkmanName);
        dwr.util.setValue("deptLinkmanMobile", task.dept.deptLinkmanMobile);
        $("deptLinkmanMobile").parentElement.href = "tel:" + task.dept.deptLinkmanMobile;
    }
    function callback() {
        location = "${ctx}/wx/page/task_truck_list.jsp?userId=${userId}&deptId=${deptId}&deptCode=${deptCode}&deptParentId=${deptParentId}";
    }
</script>